import uni from "@dcloudio/vite-plugin-uni";
import { defineConfig } from "vite";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [uni()],
  base: "./",
  css: {
    /* CSS 预处理器 */
    preprocessorOptions: {
      scss: {
        additionalData: '@import "src/styles/var.scss";'
      }
    }
  },
  build: {
    terserOptions: {
      compress: {
        // drop_console: true
      }
    },
    outDir: "public"
  },
  server: {
    proxy: {
      "/tts": {
        target: "https://robot.lnkyeah.com",
        changeOrigin: true
      },
      "/index": {
        target: "https://robot.lnkyeah.com",
        changeOrigin: true,
        ws: true,
        rewrite: path => path.replace(/^\/index/, "/index")
      },
      "/ailawapi": {
        target: "https://aipeach.lnkuone.com",
        changeOrigin: true,
        rewrite: path => path.replace(/^\/ailawapi/, "")
      }
    }
  }
});
